<?php
//添加团购页面
include("../common.inc.php");
InitGP(array("action")); //初始化变量全局返回
include("function_common.php");

$titlestr="添加文章信息";
//初始化对象
//初始化对象
include(INC_PATH."/article.class.php");
$art=new ArticleClass();

if(empty($action)){
	$selectstr=$art->getselect("typeid"); //获取分类数据
	
	//显示添加表单
	include("tpl/article_add.htm");
}elseif ($action=="save"){
	InitGP(array("title","typeid","linkurl","order","seokeywords","seodescription","body")); //初始化变量全局返回
	if(isset($title)){
		//处理数据
		//上传图片处理
		require_once (INC_PATH.'/upload.class.php');
		$f = new Upload();
		$f->setThumb(0);//设置不生成缩微图
		$f->run('fileimg',1);
		$info=$f->getInfo();
		$imgdata=$info[0]['fullsavename'];//获取第一个上传图片反馈
		//处理数据
		$arrayinsert=array(
			"title"=> Char_cv($title),
			"typeid"=> GetNum($typeid),
			"litpic"=> $imgdata ,
			"linkurl"=> Char_cv($linkurl),
			"order"=>GetNum($order) ,
			"seokeywords"=> Char_cv($seokeywords),
			"seodescription"=> Char_cv($seodescription),
			"body"=>HtmlReplace($body,-1)
		);
		
		$info=$art->add($arrayinsert);
		if($info=="OK"){
			showmsg("添加文章成功!","article_list.php");//成功
		}else showmsg($info,"-1");//出错！
	}else showmsg("缺少参数","-1");//出错！
}


?>